package com.example.mylibrary.data;

import com.example.mylibrary.greendao.DaoSession;
import com.example.mylibrary.greendao.SortDao;
import com.example.mylibrary.greendao.StudentInfoDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Unique;

import java.util.Arrays;


/**
 * Created by Administrator on 2017/12/11.
 * 学生基本信息及验证
 */
@Entity
public class StudentInfo {
	@Id(autoincrement = true)
	private Long studentID;

	//   考号
	@Unique
	private String studenCode;
//	private String stuCode;
	private String studentName;
	private String idCard;
	private String icCardNo;
	//组别id
	private long sortID;
	@ToOne(joinProperty = "sortID")
	private Sort sortid;

	private int sex;//0男1女
	private String nation;
	private String birthday;
	private String address;
	private String authority;
	private String school;
	private String gradeName;
	private String className;
	//    private int    fingerID;
//    //人脸图像保存路径
//    private String  facePath;
	private byte[] finger;
	private byte[] facePhoto;

	//学生原有头像路径
	private String facePath;
	//设备标识
	private String device;
	private int uploadState;//0未上传1上传
	private String uploadTime;
	//验证结果 0未检录、1通过、-1不通过
	@NotNull
	private int rollCallState;
	//最后一次验证通过时间
	private String finalRollCalltime;

	/** Used to resolve relations */
	@Generated(hash = 2040040024)
	private transient DaoSession daoSession;

	/** Used for active entity operations. */
	@Generated(hash = 446949611)
	private transient StudentInfoDao myDao;
	@Generated(hash = 1331698312)
	public StudentInfo(Long studentID, String studenCode, String studentName,
			String idCard, String icCardNo, long sortID, int sex, String nation,
			String birthday, String address, String authority, String school,
			String gradeName, String className, byte[] finger, byte[] facePhoto,
			String facePath, String device, int uploadState, String uploadTime,
			int rollCallState, String finalRollCalltime) {
		this.studentID = studentID;
		this.studenCode = studenCode;
		this.studentName = studentName;
		this.idCard = idCard;
		this.icCardNo = icCardNo;
		this.sortID = sortID;
		this.sex = sex;
		this.nation = nation;
		this.birthday = birthday;
		this.address = address;
		this.authority = authority;
		this.school = school;
		this.gradeName = gradeName;
		this.className = className;
		this.finger = finger;
		this.facePhoto = facePhoto;
		this.facePath = facePath;
		this.device = device;
		this.uploadState = uploadState;
		this.uploadTime = uploadTime;
		this.rollCallState = rollCallState;
		this.finalRollCalltime = finalRollCalltime;
	}
	@Generated(hash = 2016856731)
	public StudentInfo() {
	}
	public Long getStudentID() {
		return this.studentID;
	}
	public void setStudentID(Long studentID) {
		this.studentID = studentID;
	}
	public String getStudenCode() {
		return this.studenCode;
	}
	public void setStudenCode(String studenCode) {
		this.studenCode = studenCode;
	}
	public String getStudentName() {
		return this.studentName;
	}
	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}
	public String getIdCard() {
		return this.idCard;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	public String getIcCardNo() {
		return this.icCardNo;
	}
	public void setIcCardNo(String icCardNo) {
		this.icCardNo = icCardNo;
	}
	public long getSortID() {
		return this.sortID;
	}
	public void setSortID(long sortID) {
		this.sortID = sortID;
	}
	public int getSex() {
		return this.sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public String getNation() {
		return this.nation;
	}
	public void setNation(String nation) {
		this.nation = nation;
	}
	public String getBirthday() {
		return this.birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public String getAddress() {
		return this.address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getAuthority() {
		return this.authority;
	}
	public void setAuthority(String authority) {
		this.authority = authority;
	}
	public String getSchool() {
		return this.school;
	}
	public void setSchool(String school) {
		this.school = school;
	}
	public String getGradeName() {
		return this.gradeName;
	}
	public void setGradeName(String gradeName) {
		this.gradeName = gradeName;
	}
	public String getClassName() {
		return this.className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public byte[] getFinger() {
		return this.finger;
	}
	public void setFinger(byte[] finger) {
		this.finger = finger;
	}
	public byte[] getFacePhoto() {
		return this.facePhoto;
	}
	public void setFacePhoto(byte[] facePhoto) {
		this.facePhoto = facePhoto;
	}
	public String getFacePath() {
		return this.facePath;
	}
	public void setFacePath(String facePath) {
		this.facePath = facePath;
	}
	public String getDevice() {
		return this.device;
	}
	public void setDevice(String device) {
		this.device = device;
	}
	public int getUploadState() {
		return this.uploadState;
	}
	public void setUploadState(int uploadState) {
		this.uploadState = uploadState;
	}
	public String getUploadTime() {
		return this.uploadTime;
	}
	public void setUploadTime(String uploadTime) {
		this.uploadTime = uploadTime;
	}
	public int getRollCallState() {
		return this.rollCallState;
	}
	public void setRollCallState(int rollCallState) {
		this.rollCallState = rollCallState;
	}
	public String getFinalRollCalltime() {
		return this.finalRollCalltime;
	}
	public void setFinalRollCalltime(String finalRollCalltime) {
		this.finalRollCalltime = finalRollCalltime;
	}
	@Generated(hash = 339336192)
	private transient Long sortid__resolvedKey;
	/** To-one relationship, resolved on first access. */
	@Generated(hash = 1398446010)
	public Sort getSortid() {
		long __key = this.sortID;
		if (sortid__resolvedKey == null || !sortid__resolvedKey.equals(__key)) {
			final DaoSession daoSession = this.daoSession;
			if (daoSession == null) {
				throw new DaoException("Entity is detached from DAO context");
			}
			SortDao targetDao = daoSession.getSortDao();
			Sort sortidNew = targetDao.load(__key);
			synchronized (this) {
				sortid = sortidNew;
				sortid__resolvedKey = __key;
			}
		}
		return sortid;
	}
	/** called by internal mechanisms, do not call yourself. */
	@Generated(hash = 1542909416)
	public void setSortid(@NotNull Sort sortid) {
		if (sortid == null) {
			throw new DaoException(
					"To-one property 'sortID' has not-null constraint; cannot set to-one to null");
		}
		synchronized (this) {
			this.sortid = sortid;
			sortID = sortid.getSortID();
			sortid__resolvedKey = sortID;
		}
	}
	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 128553479)
	public void delete() {
		if (myDao == null) {
			throw new DaoException("Entity is detached from DAO context");
		}
		myDao.delete(this);
	}
	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 1942392019)
	public void refresh() {
		if (myDao == null) {
			throw new DaoException("Entity is detached from DAO context");
		}
		myDao.refresh(this);
	}
	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 713229351)
	public void update() {
		if (myDao == null) {
			throw new DaoException("Entity is detached from DAO context");
		}
		myDao.update(this);
	}
	/** called by internal mechanisms, do not call yourself. */
	@Generated(hash = 1653656253)
	public void __setDaoSession(DaoSession daoSession) {
		this.daoSession = daoSession;
		myDao = daoSession != null ? daoSession.getStudentInfoDao() : null;
	}

	@Override
	public String toString() {
		return "StudentInfo{" +
				"studentID=" + studentID +
				", studenCode='" + studenCode + '\'' +
				", studentName='" + studentName + '\'' +
				", idCard='" + idCard + '\'' +
				", icCardNo='" + icCardNo + '\'' +
				", sortID=" + sortID +
				", sortid=" + sortid +
				", sex=" + sex +
				", nation='" + nation + '\'' +
				", birthday='" + birthday + '\'' +
				", address='" + address + '\'' +
				", authority='" + authority + '\'' +
				", school='" + school + '\'' +
				", gradeName='" + gradeName + '\'' +
				", className='" + className + '\'' +
				", finger=" + Arrays.toString(finger) +
				", facePhoto=" + Arrays.toString(facePhoto) +
				", facePath='" + facePath + '\'' +
				", device='" + device + '\'' +
				", uploadState=" + uploadState +
				", uploadTime='" + uploadTime + '\'' +
				", rollCallState=" + rollCallState +
				", finalRollCalltime='" + finalRollCalltime + '\'' +
				", daoSession=" + daoSession +
				", myDao=" + myDao +
				", sortid__resolvedKey=" + sortid__resolvedKey +
				'}';
	}
}
